#include <windows.h>
#include <stdlib.h>

#include "mainwindow.h"
#include "operations.h"

int CALLBACK WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow )
{
	MainWindow *mainWindow;
	MSG Msg;

	mainWindow = MainWindow::instance();
	if( mainWindow )
	{
		bool success = true;
		success &= mainWindow->create( NULL, hInstance );
		success &= mainWindow->show( nCmdShow );
		mainWindow->_hInstance = hInstance;
		if( !success )
		{
			MessageBox( NULL, L"The application could not be initialized.", L"Message",
				MB_ICONEXCLAMATION | MB_OK );
			return 0;
		}
	}

	while( GetMessage( &Msg, NULL, 0, 0 ) > 0 )
	{
		TranslateMessage( &Msg );
		DispatchMessage( &Msg );
	}
	return (int) Msg.wParam;
}
